from django.db import models
from db.AbstractModel import AbstractModel


# 购物车管理类
class CartsManager(models.Manager):
    pass


# 购物车模型
class Carts(AbstractModel):
    cart_goods = models.ForeignKey('goods.GoodsInfo', verbose_name="所属商品")  # 购物车商品
    cart_amount = models.IntegerField(default=0, verbose_name="商品数量")  # 购物数量
    cart_user = models.ForeignKey('users.User', verbose_name="所属顾客")  # 购物人
    objects = CartsManager()

    def __str__(self):
        return 'Carts[cart_goods=%s, cart_amount=%s, cart_user=%s]' % (
            self.cart_goods, self.cart_amount, self.cart_user)
